﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.InterceptionExtension;
using Microsoft.Practices.Unity;

namespace Artech.PetShop.Common
{
    [AttributeUsage( AttributeTargets.Method,Inherited = false)]
    public class AuditCallHandlerAttribute : HandlerAttribute
    {
        public string Operation
        { get; private set; }

        public AuditCallHandlerAttribute(string operation)
        {
            if (string.IsNullOrEmpty(operation))
            {
                throw new ArgumentNullException("operation");
            }

            this.Operation = operation;
        }

        public override ICallHandler CreateHandler(IUnityContainer container)
        {
            return new AuditCallHandler(this.Operation) { Order = this.Order };
        }
    }
}
